<?php
namespace app\admin\controller;

use think\Controller;
use think\Exception;

class Base extends Controller
{
	protected $request;
	
	protected $admin_id;
	
	public function _initialize()
	{
		header('Access-Control-Allow-Origin:*');
		//session('admin_id',1);
		if(!$this->checkLogin()){
			echo json_encode([
					'code' => 4,
					'msg' => '请先登录'
			]);exit;
		}
		
		$this->request = request();
		$this->admin_id = session('admin_id');
	}
	
	private function checkLogin()
	{
		session('admin_id',1);
		if(!session('admin_id')){
			return false;
		}
		return true;
	}
}